package NetWork;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2022-08-16
 * Time: 11:41
 */
public class UdpDictServer extends network.UdpEchoServer {
    private Map<String,String> dict=new HashMap<>();
    public UdpDictServer(int port) throws SocketException {
        super(port);
        dict.put("cat","小猫");
    }

    @Override
    public String process(String req) {
        return dict.getOrDefault(req,"卢世杰");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer server=new UdpDictServer(8001);
        server.start();
    }
}
